 package com.oanda.blackberry.restapi;
 
 final class ReturnValue
 {
   int httpStatusCode;
   String httpStatusCodeMessage;
 
   public ReturnValue()
   {
   }
 
   public ReturnValue(int httpStatusCode, String httpStatusCodeMessage)
   {
     this.httpStatusCode = httpStatusCode;
     this.httpStatusCodeMessage = httpStatusCodeMessage;
   }
 
   public int getErrorCode()
   {
     if ((this.httpStatusCodeMessage != null) && (this.httpStatusCodeMessage.length() > 0)) {
       int index = this.httpStatusCodeMessage.indexOf(":");
       if (index > -1)
         try {
           return Integer.parseInt(this.httpStatusCodeMessage.substring(0, index));
         }
         catch (NumberFormatException nfe) {
           return -1;
         }
     }
     return -1;
   }
 
   public static int getErrorCode(String httpMessage)
   {
     if ((httpMessage != null) && (httpMessage.length() > 0)) {
       int index = httpMessage.indexOf(":");
       if (index > -1)
         try {
           return Integer.parseInt(httpMessage.substring(0, index));
         }
         catch (NumberFormatException nfe) {
           return -1;
         }
     }
     return -1;
   }
}

